<style lang="scss">
  @import 'index';
</style>

<template>
  <div class="ga-container">
    <div class="ga-consumer">
      <h1 class="h1">{{desc}}级消费者（{{list.total}}人）</h1>

      <div class="ga-media-list">
        <a href="" class="item" v-for="(item,index) in list.data" :key="index">
          <div class="item-media">
            <div class="img-box">
              <img class="img" mode="widthFix" :src="item.icon" alt="">
            </div>
          </div>
          <div class="item-inner">
              <p>
                昵称：{{item.nickname}}
              </p>
              <p>
                ID：{{item.id}}
              </p>
          </div>
        </a>
      </div>
    </div>
  </div>
</template>

<script>
import {isLogin} from '@/utils/handleLogin'
export default {

  data () {
    return {
       title: ['一','二','三'],
       desc: '',
       list: []
    }
  },
  methods: {
     async load () {
      let params = {
         level: this.$root.$mp.query.level
      }
       this.$_util.ajax.post('https://guo-a.com/mapi/user/userteamlist?token=' + this.$store.state.Token,params).then((res)=>{
           if(res.code === 200){
            this.list = res.data
           }
       })
     }
  },
  onShow () {
    if (!this.$root.$mp.query.hasOwnProperty('level')) {
      wx.navigateBack()
    }
    this.desc = this.title[this.$root.$mp.query.level-1]
    isLogin(()=>{
      this.load()
    })
  }
}
</script>
